﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据管理系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: #f5f7fa;
            color: #333;
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
        }

        /* 顶部Banner样式 */
        .banner {
            background: linear-gradient(120deg, #1e88e5, #1565c0);
            color: white;
            padding: 0 20px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            z-index: 100;
        }

            .banner h1 {
                font-size: 22px;
                font-weight: 500;
            }

        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #bbdefb;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            color: #0d47a1;
        }

        /* 主容器 */
        .container {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        /* 左侧菜单样式 */
        .sidebar {
            width: 240px;
            background: linear-gradient(to bottom, #2196f3, #1976d2);
            color: white;
            overflow-y: auto;
            padding: 20px 0;
            box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        }

        .menu-item {
            padding: 15px 25px;
            display: flex;
            align-items: center;
            gap: 15px;
            cursor: pointer;
            transition: all 0.3s;
        }

            .menu-item:hover, .menu-item.active {
                background-color: rgba(255, 255, 255, 0.1);
                border-left: 4px solid #bbdefb;
            }

            .menu-item i {
                width: 20px;
                text-align: center;
            }

        /* 右侧内容区域 */
        .content {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            background-color: #f5f7fa;
        }

        .content-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 1px solid #e0e0e0;
        }

            .content-header h2 {
                color: #1565c0;
                font-weight: 500;
            }

        /* 卡片样式 */
        .card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            padding: 20px;
            margin-bottom: 20px;
        }

        /* 搜索区域 */
        .search-box {
            display: flex;
            gap: 15px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .search-input {
            flex: 1;
            min-width: 200px;
            position: relative;
        }

            .search-input input {
                width: 100%;
                padding: 10px 15px 10px 40px;
                border: 1px solid #e0e0e0;
                border-radius: 4px;
                font-size: 14px;
            }

            .search-input i {
                position: absolute;
                left: 15px;
                top: 50%;
                transform: translateY(-50%);
                color: #9e9e9e;
            }

        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s;
        }

        .btn-primary {
            background-color: #2196f3;
            color: white;
        }

            .btn-primary:hover {
                background-color: #1976d2;
            }

        .btn-outline {
            background-color: transparent;
            border: 1px solid #2196f3;
            color: #2196f3;
        }

            .btn-outline:hover {
                background-color: #2196f3;
                color: white;
            }

        /* 表格样式 */
        .table-container {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            padding: 15px;
            text-align: left;
            border-bottom: 1px solid #e0e0e0;
        }

        th {
            background-color: #e3f2fd;
            color: #1976d2;
            font-weight: 500;
        }

        tr:hover {
            background-color: #f5f9ff;
        }

        .status {
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 12px;
            display: inline-block;
        }

        .status-active {
            background-color: #e8f5e9;
            color: #2e7d32;
        }

        .status-inactive {
            background-color: #ffebee;
            color: #c62828;
        }

        .action-buttons {
            display: flex;
            gap: 10px;
        }

        .action-btn {
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 12px;
            cursor: pointer;
        }

        .view-btn {
            background-color: #e3f2fd;
            color: #1976d2;
            border: none;
        }

        .edit-btn {
            background-color: #e8f5e9;
            color: #2e7d32;
            border: none;
        }

        .delete-btn {
            background-color: #ffebee;
            color: #c62828;
            border: none;
        }

        /* 分页样式 */
        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 20px;
            gap: 10px;
        }

            .pagination button {
                padding: 8px 15px;
                border: 1px solid #e0e0e0;
                background-color: white;
                border-radius: 4px;
                cursor: pointer;
            }

                .pagination button.active {
                    background-color: #2196f3;
                    color: white;
                    border-color: #2196f3;
                }

        /* 详情页面 */
        .detail-page, .add-page, .edit-page {
            display: none;
        }

        .detail-header, .form-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .detail-card, .form-card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            padding: 25px;
        }

        .detail-row {
            display: flex;
            margin-bottom: 20px;
            border-bottom: 1px solid #f0f0f0;
            padding-bottom: 20px;
        }

        .detail-label {
            width: 150px;
            font-weight: 500;
            color: #616161;
        }

        .detail-value {
            flex: 1;
            color: #424242;
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #616161;
        }

        .form-control {
            width: 100%;
            padding: 10px 15px;
            border: 1px solid #e0e0e0;
            border-radius: 4px;
            font-size: 14px;
        }

            .form-control:focus {
                outline: none;
                border-color: #2196f3;
                box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
            }

        textarea.form-control {
            min-height: 100px;
            resize: vertical;
        }

        .form-hint {
            font-size: 12px;
            color: #9e9e9e;
            margin-top: 5px;
        }

        .form-actions {
            display: flex;
            justify-content: flex-end;
            gap: 15px;
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #f0f0f0;
        }

        .radio-group {
            display: flex;
            gap: 20px;
        }

        .radio-item {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* 头像上传样式 */
        .avatar-upload {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 15px;
        }

        .avatar-preview {
            width: 120px;
            height: 120px;
            border-radius: 8px;
            border: 2px dashed #90caf9;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            background-color: #f5f9ff;
        }

            .avatar-preview img {
                max-width: 100%;
                max-height: 100%;
                display: none;
            }

            .avatar-preview i {
                font-size: 40px;
                color: #90caf9;
            }

        .avatar-actions {
            display: flex;
            gap: 10px;
        }

        .file-input {
            display: none;
        }

        .btn-avatar {
            padding: 8px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
        }

        .btn-avatar-primary {
            background-color: #2196f3;
            color: white;
        }

        .btn-avatar-outline {
            background-color: transparent;
            border: 1px solid #2196f3;
            color: #2196f3;
        }

        /* 响应式设计 */
        @@media (max-width: 768px) {
            .sidebar

        {
            width: 70px;
        }

        .menu-item span {
            display: none;
        }

        .menu-item {
            justify-content: center;
            padding: 15px 0;
        }

            .menu-item i {
                font-size: 20px;
            }

        .search-box {
            flex-direction: column;
        }

        .search-input {
            width: 100%;
        }

        .detail-row {
            flex-direction: column;
        }

        .detail-label {
            width: 100%;
            margin-bottom: 8px;
        }

        .avatar-upload {
            align-items: center;
        }

        }
    </style>
</head>
<body>
    <!-- 顶部Banner -->
    <div class="banner">
        <h1>数据管理系统</h1>
        <div class="user-info">
            <div class="user-avatar">JD</div>
            <span>管理员</span>
        </div>
    </div>

    <div class="container">
        <!-- 左侧菜单 -->
        <div class="sidebar">
            <div class="menu-item active">
                <i class="fas fa-home"></i>
                <span>控制面板</span>
            </div>
            <div class="menu-item">
                <i class="fas fa-database"></i>
                <span>数据管理</span>
            </div>
            <div class="menu-item">
                <i class="fas fa-chart-bar"></i>
                <span>统计分析</span>
            </div>
            <div class="menu-item">
                <i class="fas fa-cog"></i>
                <span>系统设置</span>
            </div>
            <div class="menu-item">
                <i class="fas fa-users"></i>
                <span>用户管理</span>
            </div>
            <div class="menu-item">
                <i class="fas fa-file-alt"></i>
                <span>日志管理</span>
            </div>
        </div>

        <!-- 右侧内容区域 -->
        <div class="content">
            <!-- 列表页面 -->
            <div class="list-page">
                <div class="content-header">
                    <h2>数据列表</h2>
                    <button class="btn btn-primary" onclick="showAddPage()">
                        <i class="fas fa-plus"></i> 新增数据
                    </button>
                </div>

                <div class="card">
                    <div class="search-box">
                        <div class="search-input">
                            <i class="fas fa-search"></i>
                            <input type="text" placeholder="输入关键词搜索...">
                        </div>
                        <select class="btn-outline">
                            <option>全部状态</option>
                            <option>启用</option>
                            <option>禁用</option>
                        </select>
                        <select class="btn-outline">
                            <option>全部类别</option>
                            <option>类别一</option>
                            <option>类别二</option>
                        </select>
                        <button class="btn btn-primary">搜索</button>
                    </div>

                    <div class="table-container">
                        <table>
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>头像</th>
                                    <th>名称</th>
                                    <th>描述</th>
                                    <th>状态</th>
                                    <th>创建时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>10001</td>
                                    <td><div class="user-avatar" style="background-color: #e3f2fd; color: #1976d2;">A</div></td>
                                    <td>项目数据A</td>
                                    <td>这是项目A的描述信息</td>
                                    <td><span class="status status-active">启用</span></td>
                                    <td>2023-06-15</td>
                                    <td class="action-buttons">
                                        <button class="action-btn view-btn" onclick="showDetail()">查看</button>
                                        <button class="action-btn edit-btn" onclick="showEditPage()">编辑</button>
                                        <button class="action-btn delete-btn">删除</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>10002</td>
                                    <td><div class="user-avatar" style="background-color: #ffebee; color: #c62828;">B</div></td>
                                    <td>项目数据B</td>
                                    <td>这是项目B的描述信息</td>
                                    <td><span class="status status-inactive">禁用</span></td>
                                    <td>2023-06-10</td>
                                    <td class="action-buttons">
                                        <button class="action-btn view-btn" onclick="showDetail()">查看</button>
                                        <button class="action-btn edit-btn" onclick="showEditPage()">编辑</button>
                                        <button class="action-btn delete-btn">删除</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>10003</td>
                                    <td><div class="user-avatar" style="background-color: #e8f5e9; color: #2e7d32;">C</div></td>
                                    <td>项目数据C</td>
                                    <td>这是项目C的描述信息</td>
                                    <td><span class="status status-active">启用</span></td>
                                    <td>2023-06-05</td>
                                    <td class="action-buttons">
                                        <button class="action-btn view-btn" onclick="showDetail()">查看</button>
                                        <button class="action-btn edit-btn" onclick="showEditPage()">编辑</button>
                                        <button class="action-btn delete-btn">删除</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>

                    <div class="pagination">
                        <button><i class="fas fa-angle-left"></i></button>
                        <button class="active">1</button>
                        <button>2</button>
                        <button>3</button>
                        <button>4</button>
                        <button>5</button>
                        <button><i class="fas fa-angle-right"></i></button>
                    </div>
                </div>
            </div>

            <!-- 详情页面 -->
            <div class="detail-page">
                <div class="detail-header">
                    <h2>数据详情</h2>
                    <button class="btn btn-outline" onclick="showListPage()">
                        <i class="fas fa-arrow-left"></i> 返回列表
                    </button>
                </div>

                <div class="detail-card">
                    <div class="detail-row">
                        <div class="detail-label">ID</div>
                        <div class="detail-value">10001</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">头像</div>
                        <div class="detail-value">
                            <div class="user-avatar" style="width: 80px; height: 80px; font-size: 30px; background-color: #e3f2fd; color: #1976d2;">A</div>
                        </div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">名称</div>
                        <div class="detail-value">项目数据A</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">描述</div>
                        <div class="detail-value">这是项目A的详细描述信息，包含了项目的所有关键信息和详细内容，用于展示详情页面的布局和样式效果。</div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">状态</div>
                        <div class="detail-value"><span class="status status-active">启用</span></div>
                    </div>
                    <div class="detail-row">
                        <div class="detail-label">创建时间</div>
                        <div class="detail-value">2023-06-15 14:30:25</div>
                    </div>
                </div>
            </div>

            <!-- 新增页面 -->
            <div class="add-page">
                <div class="form-header">
                    <h2>新增数据</h2>
                    <button class="btn btn-outline" onclick="showListPage()">
                        <i class="fas fa-arrow-left"></i> 返回列表
                    </button>
                </div>

                <div class="form-card">
                    <form id="add-form">
                        <div class="form-group">
                            <label class="form-label">头像</label>
                            <div class="avatar-upload">
                                <div class="avatar-preview" id="add-avatar-preview">
                                    <i class="fas fa-user"></i>
                                    <img id="add-avatar-image" src="" alt="头像预览">
                                </div>
                                <div class="avatar-actions">
                                    <input type="file" id="add-avatar-input" class="file-input" accept="image/*">
                                    <button type="button" class="btn-avatar btn-avatar-primary" onclick="document.getElementById('add-avatar-input').click()">
                                        选择图片
                                    </button>
                                    <button type="button" class="btn-avatar btn-avatar-outline" onclick="resetAvatar('add')">
                                        重置
                                    </button>
                                </div>
                                <div class="form-hint">支持jpg、png格式，大小不超过2MB</div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="form-label">名称</label>
                            <input type="text" class="form-control" placeholder="请输入名称">
                            <div class="form-hint">数据的名称，最多50个字符</div>
                        </div>

                        <div class="form-group">
                            <label class="form-label">描述</label>
                            <textarea class="form-control" placeholder="请输入描述"></textarea>
                            <div class="form-hint">数据的详细描述信息</div>
                        </div>

                        <div class="form-group">
                            <label class="form-label">类型</label>
                            <select class="form-control">
                                <option value="">请选择类型</option>
                                <option value="1">类型一</option>
                                <option value="2">类型二</option>
                                <option value="3">类型三</option>
                            </select>
                        </div>

                        <div class="form-group">
                            <label class="form-label">状态</label>
                            <div class="radio-group">
                                <div class="radio-item">
                                    <input type="radio" id="add-status-active" name="status" value="1" checked>
                                    <label for="add-status-active">启用</label>
                                </div>
                                <div class="radio-item">
                                    <input type="radio" id="add-status-inactive" name="status" value="0">
                                    <label for="add-status-inactive">禁用</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-actions">
                            <button type="button" class="btn btn-outline" onclick="showListPage()">取消</button>
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </form>
                </div>
            </div>

            <!-- 编辑页面 -->
            <div class="edit-page">
                <div class="form-header">
                    <h2>编辑数据</h2>
                    <button class="btn btn-outline" onclick="showListPage()">
                        <i class="fas fa-arrow-left"></i> 返回列表
                    </button>
                </div>

                <div class="form-card">
                    <form id="edit-form">
                        <div class="form-group">
                            <label class="form-label">ID</label>
                            <input type="text" class="form-control" value="10001" disabled>
                        </div>

                        <div class="form-group">
                            <label class="form-label">头像</label>
                            <div class="avatar-upload">
                                <div class="avatar-preview" id="edit-avatar-preview">
                                    <i class="fas fa-user"></i>
                                    <img id="edit-avatar-image" src="" alt="头像预览">
                                </div>
                                <div class="avatar-actions">
                                    <input type="file" id="edit-avatar-input" class="file-input" accept="image/*">
                                    <button type="button" class="btn-avatar btn-avatar-primary" onclick="document.getElementById('edit-avatar-input').click()">
                                        选择图片
                                    </button>
                                    <button type="button" class="btn-avatar btn-avatar-outline" onclick="resetAvatar('edit')">
                                        重置
                                    </button>
                                </div>
                                <div class="form-hint">支持jpg、png格式，大小不超过2MB</div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="form-label">名称</label>
                            <input type="text" class="form-control" value="项目数据A">
                            <div class="form-hint">数据的名称，最多50个字符</div>
                        </div>

                        <div class="form-group">
                            <label class="form-label">描述</label>
                            <textarea class="form-control">这是项目A的详细描述信息，包含了项目的所有关键信息和详细内容。</textarea>
                            <div class="form-hint">数据的详细描述信息</div>
                        </div>

                        <div class="form-group">
                            <label class="form-label">类型</label>
                            <select class="form-control">
                                <option value="1" selected>类型一</option>
                                <option value="2">类型二</option>
                                <option value="3">类型三</option>
                            </select>
                        </div>

                        <div class="form-group">
                            <label class="form-label">状态</label>
                            <div class="radio-group">
                                <div class="radio-item">
                                    <input type="radio" id="edit-status-active" name="edit-status" value="1" checked>
                                    <label for="edit-status-active">启用</label>
                                </div>
                                <div class="radio-item">
                                    <input type="radio" id="edit-status-inactive" name="edit-status" value="0">
                                    <label for="edit-status-inactive">禁用</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-actions">
                            <button type="button" class="btn btn-outline" onclick="showListPage()">取消</button>
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 显示列表页面
        function showListPage() {
            document.querySelector('.list-page').style.display = 'block';
            document.querySelector('.detail-page').style.display = 'none';
            document.querySelector('.add-page').style.display = 'none';
            document.querySelector('.edit-page').style.display = 'none';
        }

        // 显示详情页面
        function showDetail() {
            document.querySelector('.list-page').style.display = 'none';
            document.querySelector('.detail-page').style.display = 'block';
            document.querySelector('.add-page').style.display = 'none';
            document.querySelector('.edit-page').style.display = 'none';
        }

        // 显示新增页面
        function showAddPage() {
            document.querySelector('.list-page').style.display = 'none';
            document.querySelector('.detail-page').style.display = 'none';
            document.querySelector('.add-page').style.display = 'block';
            document.querySelector('.edit-page').style.display = 'none';

            // 重置新增表单
            resetAvatar('add');
        }

        // 显示编辑页面
        function showEditPage() {
            document.querySelector('.list-page').style.display = 'none';
            document.querySelector('.detail-page').style.display = 'none';
            document.querySelector('.add-page').style.display = 'none';
            document.querySelector('.edit-page').style.display = 'block';

            // 模拟已有头像
            document.getElementById('edit-avatar-preview').querySelector('i').style.display = 'none';
            document.getElementById('edit-avatar-image').style.display = 'block';
            document.getElementById('edit-avatar-image').src = 'https://via.placeholder.com/120x120/2196F3/FFFFFF?text=A';
        }

        // 重置头像
        function resetAvatar(type) {
            const preview = document.getElementById(`${type}-avatar-preview`);
            const icon = preview.querySelector('i');
            const image = preview.querySelector('img');
            const fileInput = document.getElementById(`${type}-avatar-input`);

            icon.style.display = 'flex';
            image.style.display = 'none';
            image.src = '';
            fileInput.value = '';
        }

        // 初始化头像上传功能
        function initAvatarUpload() {
            // 新增页面头像上传
            document.getElementById('add-avatar-input').addEventListener('change', function(e) {
                handleAvatarUpload(e, 'add');
            });

            // 编辑页面头像上传
            document.getElementById('edit-avatar-input').addEventListener('change', function(e) {
                handleAvatarUpload(e, 'edit');
            });
        }

        // 处理头像上传
        function handleAvatarUpload(event, type) {
            const file = event.target.files[0];
            if (!file) return;

            // 检查文件类型
            if (!file.type.match('image.*')) {
                alert('请选择图片文件！');
                return;
            }

            // 检查文件大小（2MB以内）
            if (file.size > 2 * 1024 * 1024) {
                alert('图片大小不能超过2MB！');
                return;
            }

            const reader = new FileReader();
            reader.onload = function(e) {
                const preview = document.getElementById(`${type}-avatar-preview`);
                const icon = preview.querySelector('i');
                const image = preview.querySelector('img');

                icon.style.display = 'none';
                image.style.display = 'block';
                image.src = e.target.result;
            };
            reader.readAsDataURL(file);
        }

        // 菜单项点击效果
        const menuItems = document.querySelectorAll('.menu-item');
        menuItems.forEach(item => {
            item.addEventListener('click', function() {
                menuItems.forEach(i => i.classList.remove('active'));
                this.classList.add('active');
            });
        });

        // 表单提交处理
        document.getElementById('add-form').addEventListener('submit', function(e) {
            e.preventDefault();
            alert('新增数据提交成功！');
            showListPage();
        });

        document.getElementById('edit-form').addEventListener('submit', function(e) {
            e.preventDefault();
            alert('数据修改保存成功！');
            showListPage();
        });

        // 初始化
        function init() {
            showListPage();
            initAvatarUpload();
        }

        // 页面加载完成后初始化
        window.onload = init;
    </script>
</body>
</html>